Skip to main content

Import SMR Catalogue file

This will import catalogue of SMR job items with costs for a given customer and supplier.

NOTE:

Max allowed file size is 1.1Mb.

Fields​

Field NameDescriptionDatatypeValidationMax lengthMandatoryExample
Supplieraccount Id/group IdstringValid stringUnlimitedYesjBybqdJA9wZQHEmLQDai
Product

Type of catalogue (This is not required
for the import, but used as a reference i
in the file)

NANANANASMR
Vehicle IdentifierUnique Id for a vehicle Make & ModelstringAllow any string that consists only of hyphens, plus signs, word characters, and whitespace characters. It will not allow any strings that contain other characters or characters that are not included in the pattern.UnlimitedNo12345678
Repair Type IdUnique Id issues by ViSNstringAllow any string that consists only of hyphens, plus signs, word characters, and whitespace characters. It will not allow any strings that contain other characters or characters that are not included in the pattern.UnlimitedYes9239238
Repair DescriptionBrief description of the job item

Allow string that consists only of uppercase and lowercase letters, digits, underscores, at symbols, periods, forward slashes, hash symbols, ampersands, plus signs, hyphens, parentheses, square brackets, and double quotes. It will not allow any strings that contain other characters or characters that are not included in the pattern.

(Filters) Fuel ERACFUEL
MakeVehicle MakestringAllow any string that consists only of hyphens, plus signs, word characters, and whitespace characters. It will not allow any strings that contain other characters or characters that are not included in the pattern.UnlimitedYesCITROEN
ModelVehicle ModelstringValid string. Saved as default when emptyUnlimitedNoGRAND C4 SPACETOURER
Vehicle TypeVehicle type the price applies tostringCase-insensitive, one of: Car, LCV, Van, Commercial (under 3.5), Commercial (over 3.5), HGV, Motor Bike, Electric Car. Saved as default when emptyNANoCar
Net CostCostdecimalvalid numberYes45.90
Uplift CostUplifted costdecimalUp to 5 digits with up to 2 decimal places. Must not be lower than Net CostNo50.00
Customer Account NumberCustomer account the price applies tostringLetters, digits and underscores only. Saved as default when emptyUnlimitedNoACC_45829

Combination of Make, Model, Repair Type Id, Vehicle Identifier, Vehicle Type and Customer Account Number must be unique. These fields, in that order, generate the document id; empty fields become default. For example BMW, SERIES 2, 2220016, 1300087, Car and ACC_45829 generates bmw-series-2-2220016-1300087-car-acc_45829; with Model, Vehicle Type and Customer Account Number empty it generates bmw-default-2220016-1300087-default-default

Importing a file​

Preparation​

  1. Create a new branch with Jira task number in the branch name
  2. Delete all the files in importFiles folder
  3. Create a folder with the current sprint number
  4. Copy the file that needs to be imported
  5. Go to package.json , find the line validate:smrPriceCatalogue
  6. Modify --leaseId with the required lease Id
  7. Modify --file with the relative path of the file
  8. Save package.json

Validating locally​

  1. in a terminal run npm run validate:smrPriceCatalogue
  2. If there are no errors, push the code

Validating in workflow​

  1. Go to Action of Import-manger
  2. Find <Environment> - on-demand-import
  3. Select the branch that was created for this import
  4. Enter script name as validate:smrPriceCatalogue
  5. Leave Overrides empty

Importing the file​

  1. If the validation has passed
  2. Go to Action of Import-manger
  3. Find <Environment> - on-demand-import
  4. Select the branch that was created for this import
  5. Enter script name as validate:smrPriceCatalogue
  6. Enter --persist in Overrides field

Testing​

  1. A folder will be created (if not already exists) in Firestore, under the /accounts/<accountId from the import file>/cataloguePrice/<lease Id from package.json>/smr
  2. New documents will be added in Typesense > smrCatalogueIndex
Status: Accepted
Category: Protected
Authored By: Vishwa on Mar 26, 2023
Revisions.